@extends('edu::layouts.front')

@push('scripts')
    <script src="https://cdn.bootcdn.net/ajax/libs/hls.js/8.0.0-beta.3/hls.min.js"></script>

    <script>
        window.live =@json($live);
        let video = document.getElementById('video');
        let videoSrc = "{{$config['play']['hls'] ?? '' }}";
        if (Hls.isSupported()) {
            var hls = new Hls();
            hls.loadSource(videoSrc);
            hls.attachMedia(video);

        } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
            video.src = videoSrc;
        }
    </script>
@endpush
@section('content')
    <div class="container mt-3">
        <div class="row">
            <div class="col-12 col-sm-8 ">
                <div class="card shadow-sm" style="height: 100%">
                    <div class="card-header bg-white">
                        {{$config['title']}}
                    </div>
                    <div class="card-body p-0">
                        {{--                        @if($config['is_live'])--}}
                        <div style="background: #22262f">
                            <video id="video" width="100%" autoplay muted controls></video>
                        </div>
                        {{--                        @else--}}
                        {{--                           @include('edu::layouts.nothingTips',['content'=>'主播不在线'])--}}
                        {{--                        @endif--}}
                    </div>
                    <div class="card-footer bg-white">
                        {{$config['description']}}
                    </div>
                </div>
            </div>
            <div id="app" class="col-12 col-sm-4 d-flex pl-sm-0 shadow-sm">
                <live-chat live_id="{{$live['id']}}"></live-chat>
            </div>
        </div>
    </div>
    <div class="container">

            <div id="app2">
                <live-admin :listname="[['未禁言','已禁言'],['未踢出','已踢出']]"
                            speek-action="{{route('liveAdmin.speek')}}"
                            kickout-action="{{route('liveAdmin.kickout')}}"
                            live_id="{{$live['id']}}"
                            data-action="{{route('liveAdmin.index')}}"
                ></live-admin>
            </div>

    </div>
@endsection


